package com.buba.util;

import com.buba.pojo.Message;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 杨柳
 * @title MyExceptionHandler
 * @date 2024/5/17 9:07
 */
@ControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Message exceptionHandler(Exception e) {
        e.printStackTrace();
        return new Message(0, "发生错误");
    }
}
